<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ page import="com.scalar.chiptrack.users.User,
                com.scalar.chiptrack.users.UserGroup,
                com.scalar.chiptrack.commons.SessionKeys"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/jsp/sales/sales.jsp"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.chiptrack.users.Functionality" %>
<%@ page import="com.scalar.chiptrack.rma.forms.RMAForm" %>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>


<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<Script language="JavaScript">

	function searchRMA()
    {
		document.rma_list.action.value = "Search";
		document.rma_list.submit();
	}

    function openRMA()
    {
        newWindow = window.open('generateRMA.do?action=PrintRMA&rmaId=<%=(String)request.getAttribute("rmaId")%>','RmaOptionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=600,left=100,top=50,resizable=yes');
  	    newWindow.focus();
    }

    function openCancelledRMA(rmaID)
    {
        newWindow = window.open('generateRMA.do?action=PrintRMA&rmaId='+rmaID,'RmaOptionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=600,left=100,top=50,resizable=yes');
  	    newWindow.focus();
    }
    function viewRMA(rmaId)
    {
        newWindow = window.open('generateRMA.do?action=PrintRMA&rmaId='+rmaId,'RmaOptionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=600,left=100,top=50,resizable=yes');
  	    newWindow.focus();
    }


</Script>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<table cellSpacing=0 cellPadding=0 width="100%" border=0>
    <tr>
        <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@ include file="/jsp/sales/rma_menu.jsp" %>
            <!-- end of the side navigations -->
        </td>
        <td bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></td>
        <td bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></td>
        <td valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
            <html:form name="rma_list" onsubmit="return searchRMA();" method="post" action="/rma.do" scope="request" type="com.scalar.chiptrack.rma.forms.RMAListForm" >
            <center><span class="NArialW">RMA Form&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></center>
            <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
            <table border="0" width="90%" align=center>
                <tr><td colspan =7 align="left" class='NArialL'><font class="NArialL" id="message1" color="green">&nbsp;</font></td></tr>
                <tr><td colspan =7 align="left" class='NArialL'><font class="NArialL" id="message2" color="FF0000">&nbsp;</font></td></tr>
                <tr><td colspan =7 class="NArialL"><chiptrack:info styleClass="NArialL" /></td></tr>
                <tr><td colspan =7 class="NArialL"><chiptrack:errors styleClass="NArialL" /><br></td></tr>
                <!--<tr><td colspan =7 class="NArialL"--><!--chiptrack:errors styleClass="NArialL" /></td></tr>-->
                <!--tr><td colspan =7 class="NArialL"--><!--chiptrack:messages type="info" styleClass="NArialL" /></td></tr-->
                <tr>
                    <td>
                        <table border="0" width="100%" align=right>
                            <tr>
                                <td width="15%" class="NArialL">RMA Number</td>
                                <td width="20%" class="NArialL">
                                    <html:text property="rmaNumber" styleClass="txfield" size="23" />
                                </td>
                                <td width="15%" class="NArialL">Customer Name</td>
                                <td width="15%" colspan="2">
                                    <html:select property="customerName" styleClass="txfield">
                                        <%--<html:option value="" />--%>
                                        <html:options collection="customerslist" property="value" labelProperty="label"/>
                                    </html:select>
                                </td>
                            </tr>
                            <tr>
                                <td class="NArialL">Status</td>
                                <td class="NArialL">
                                    <html:select property="rmaStatus" styleClass="txfield" style="width:160px">
                                        <html:option value="All">All</html:option>
                                        <html:option value="ISSUED">ISSUED</html:option>
                                        <html:option value="CLOSE">CLOSE</html:option>
                                        <html:option value="CANCELLED">CANCELLED</html:option>
                                        <html:option value="APPROVED">APPROVED</html:option>
                                    </html:select>
                                </td>
                                <td colspan="3">&nbsp;</td>
                            </tr>
                            <tr><td colspan="5">&nbsp;</td></tr>
                            <tr>
                                <td colspan="5" align="center">
                                    <input type=image border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif" width="53" height="17" onmouseover="window.status='Click to Search RMA';return true" onmouseout="window.status='';return true" title="Click here to Search for RMA">
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href="#" onclick="javascript:document.rma_list.reset();" onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset">
                                        <img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17" />
                                    </a>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td><img height=10 src="images/spacer.gif"></td></tr>
                    <tr>
                        <td>
                            <table border="0" width="100%" bordercolor="#FFFFFF" align=right>
                                <tr>
                                    <td class="NArialL" colspan=5>
                                        To Generate new RMA Form, please
                                        <chiptrack:restrictedLink functionality='<%=Functionality.RMA_FORM%>' action='<%=User.USER_ACTION_VIEW%>' styleClass="leftsection" href='<%=chipTracContext + "/selectCustomerForRma.do"%>' onmouseover="window.status='Click to create a new RMA Form';return true" onmouseout="window.status='';return true">click here</chiptrack:restrictedLink>
                                    </td>
                                </tr>
                                <tr><td class="NArialL" colspan=4><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <% int bgcount = 0;%>
                            <logic:equal name="showList" value="TRUE">
                            <table border="0" width="100%" bordercolor="#FFFFFF" align=right>
                                <tr><td class="NArialL"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10 /></td></tr>
                                <tr>
                                   <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Customer Name</font></td>
                                   <td width="17%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Action</font></td>
                                </tr>
                                <logic:iterate id="Customer" name="customers">
                                <% bgcount = bgcount + 1; %>
                                <tr>
                                    <td width="15%" align="left" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                        <font class="NArialL">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 	<bean:write name="Customer" property="customerName" /></font>
                                    </td>
                                    <td width="17%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                        <font class="NArialL">
                                            <chiptrack:linkCustomer page="/generateRMA.do?action=CreateForm" onmouseover="window.status='Click to Create New RMA Form';return true" onmouseout="window.status='';return true">Create RMA Form</chiptrack:linkCustomer>
                                        </font>
                                    </td>
                                </tr>
                                </logic:iterate>
                            </table>
                            </logic:equal>
                            <logic:equal name="showTable" value="TRUE">
                            <table border="0" width="100%" bordercolor="#FFFFFF" align=right>
                                <tr>
                                    <td class="NArialL"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td>
                                </tr>
                                <tr>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">RMA Number</font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Customer Name</font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Requested Date</font></td>
                                    <td width="15%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Issued Date</font></td>
                                    <td width="17%" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Status</font></td>
                                    <td colspan="3" align="center" bgcolor="#993333" class="NArialL"><font color="#FFFFFF">Action</font></td>
                                    <%--<td width="17%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Approve</font></td>--%>
                                </tr>
                                <logic:iterate id="rmaForm" name="rmaList" type="com.scalar.chiptrack.rma.forms.RMAForm" >
                                <%
                                    bgcount = bgcount + 1;
                                    int rmaId = rmaForm.getRmaId();
                                %>
                                <tr>
                                    <td width="15%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                        <font class="NArialL"><bean:write name="rmaForm" property="rmaNumber"/></font>
                                    </td>
                                    <td width="15%" align="left" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="rmaForm" property="customerName" /></font></td>
                                    <td width="15%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="rmaForm" property="rmaRequestDate" /></font></td>
                                    <td width="15%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="rmaForm" property="rmaIssueDate" /></font></td>
                                    <td width="15%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>><font class="NArialL"><bean:write name="rmaForm" property="rmaStatus" /></font></td>
                                    <td  align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                        <font class="NArialL">
                                        <%--<a href='<%= chipTracContext%>/generateRMA.do?action=UpdateRMAForm&rmaId=<bean:write name="RMAForm" property="rmaId" />' class="leftsection" onmouseover="window.status='Click here to view RMA';return true" onmouseout="window.status='';return true">View</a>
                                        <a href='<%= chipTracContext%>/generateRMA.do?action=PrintRMA&rmaId=<bean:write name="RMAForm" property="rmaId" />' class="leftsection" onmouseover="window.status='Click here to view RMA';return true" onmouseout="window.status='';return true">View</a>--%>
                                        <a href='JavaScript:viewRMA(rmaId=<bean:write name="rmaForm" property="rmaId" />)' onMouseOver="window.status='Click to RMA Form';return true" onMouseOut="window.status='';return true">View</a>
                                        </font>
                                    </td>
                                    <td  align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                        <font class="NArialL">
                                            <logic:equal name="rmaForm" property="rmaStatus" value="ISSUED">
                                                <a href='<%= chipTracContext%>/generateRMA.do?action=UpdateRMAForm&rmaId=<bean:write name="rmaForm" property="rmaId" />' onMouseOver="window.status='Click to RMA Form';return true" onMouseOut="window.status='';return true">Modify</a>
                                            </logic:equal>
                                            <logic:notEqual name="rmaForm" property="rmaStatus" value="ISSUED">
                                            <logic:equal name="rmaForm" property="rmaStatus" value="APPROVED">
                                                <a href='<%= chipTracContext%>/generateRMA.do?action=UpdateRMAForm&rmaId=<bean:write name="rmaForm" property="rmaId" />' onMouseOver="window.status='Click to RMA Form';return true" onMouseOut="window.status='';return true">
                                              Modify</a>
                                            </logic:equal>
                                            </logic:notEqual>
                                        </font>
                                    </td>
                                    <td align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                         <font class="leftsection">
                                            <logic:equal name="rmaForm" property="rmaStatus" value="ISSUED">
                                            <chiptrack:restrictedLink functionality='<%=Functionality.APPROVE_RMA%>' action='<%=User.USER_ACTION_MODIFY%>' styleClass="leftsection" href='<%=chipTracContext + "/generateRMA.do?action=ApproveRMAForm&rmaId=" + rmaId %>' onmouseover="window.status='Click to Approve Rma';return true" onmouseout="window.status='';return true">Approve</chiptrack:restrictedLink>
                                            </logic:equal>
                                        </font>
                                    </td>
                                </tr>
                                </logic:iterate>
                            </table>
                            </logic:equal>
                        </td>
                    </tr>
            </table>
            <input type="hidden" name="action" value="">
        </html:form>
        <BR><BR><BR>
        </td>
        <td bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></td>
    </tr>
</table>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
